function [InitialLabel] = Ddavid_kNN_recover_binary_initialize_negative_instances(Label)

% [InitialLabel] = Ddavid_kNN_recover_binary_initialize_negative_instances(Label)
%
% <Input>
% Label: [n*1], the value is {0, 1}, the labels of all instances, where
%        there is no known negative label
%
% <Output>
% InitialLabel: [n*1], the value is {-1, 0, 1}, the initial labels of all
%               instances

PositiveSize = numel(Label, Label == 1);
InitialLabel = Label;

ZeroList = find(Label == 0);
ZeroSize = size(ZeroList, 1);
for i = ZeroSize:(-1):2
    RandNum = randi([1 i], 1);
    if(RandNum ~= i)
        Temp = ZeroList(RandNum);
        ZeroList(RandNum) = ZeroList(i);
        ZeroList(i) = Temp;
    end
end

if(PositiveSize < ZeroSize)
    InitialLabel(ZeroList(1:PositiveSize)) = -1;
else
    InitialLabel(ZeroList(:)) = -1;
end
